package com.site.blog.my.core.test;

import org.junit.Test;

public class HelloBase  {
    public static void main(String[] args) {
        NumTest numTest = new NumTest();
        for(int i=0;i<4;i++){
            Thread thread = new Thread(numTest);
            thread.start();
        }
        System.out.println(numTest.getNum());
    }
}

class NumTest implements Runnable{
    private int num = 1;

    public int getNum() {
        return num;
    }

    public void setNum(int num) {
        this.num = num;
    }

    @Override
    public void run() {
        for(int i=0;i<10000;i++){
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            num++;
        }
    }
}